//
//  TextTableViewCell.m
//  FVQuickMessage
//
//  Created by dllo on 16/8/22.
//  Copyright © 2016年 zty. All rights reserved.
//

#import "TextTableViewCell.h"
#import "SmileModel.h"
#import "LHMGetHeightTool.h"

@interface TextTableViewCell ()

@property (nonatomic, retain) UILabel *titleLabel;

@end

@implementation TextTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}


-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.titleLabel = [[UILabel alloc] init];
        [self.contentView addSubview:_titleLabel];
    }
    return self;
}

-(void)layoutSubviews {
    
    [super layoutSubviews];
    CGFloat titleHeight = [LHMGetHeightTool heightWith:self.smileModel.text];
    
    self.titleLabel.frame = CGRectMake(10, 35, self.contentView.bounds.size.width - 20, titleHeight);
    self.titleLabel.backgroundColor = [UIColor whiteColor];
    self.titleLabel.numberOfLines = 0;
    
}

-(void)setSmileModel:(SmileModel *)smileModel {
    
    if (_smileModel != smileModel) {
        _smileModel = smileModel;
    }
    
    self.titleLabel.text = smileModel.text;
    
}

@end
